package com.junwell.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junwell.entity.Standard;
import com.junwell.entity.Station;
import com.junwell.mapper.StandardMapper;
import com.junwell.mapper.StationMapper;
import com.junwell.service.StandardService;
import com.junwell.service.StationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 */
@Service
public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> implements StandardService {

    @Autowired
    private  StandardMapper standardMapper;

    @Override
    public boolean add(Standard standard) {
        int i = standardMapper.insert(standard);
        return i>0? true:false;
    }

    @Override
    public Standard viewOne(Integer id) {
        QueryWrapper<Standard> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id",id);
        Standard standard = standardMapper.selectOne(queryWrapper);
        return  standard;
    }

    @Override
    public boolean update(Standard standard) {
        int i = standardMapper.updateById(standard);
        return i>0? true:false;
    }

    @Override
    public boolean delete(Integer id) {
        QueryWrapper<Standard> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id",id);
        int i = standardMapper.delete(queryWrapper);
        return i>0? true:false;
    }
}
